import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

class BillPriceTitle extends StatelessWidget {
  final int price;
  final String title;

  const BillPriceTitle({
    this.price,
    this.title,
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final prices = AmountUtil.price2yf(price);
    final yuan = prices[0];
    String fen ='00';


    if(prices.length!=1){
       fen = prices[1];
    }


    return Expanded(
      child: Column(
        children: <Widget>[
          RichText(
            text: TextSpan(
              text: '$yuan',
              style: TextStyle(
                height: 1,
                fontSize: 50.sp,
                fontFamily: 'DINAlternate-Bold',
              ),
              children: [
                TextSpan(
                  text: '.$fen',
                  style: TextStyle(
                    fontSize: 32.sp,
                    height: 1,
                    fontFamily: 'DINAlternate-Bold',
                  ),
                ),
              ],
            ),
            overflow: TextOverflow.ellipsis,
          ),
          Container(
            margin: EdgeInsets.only(
              top: 23.w,
            ),
            child: RichText(
              text: TextSpan(
                text: '$title',
                style: TextStyle(
                  fontSize: 24.sp,
                  color: Colors.white.withOpacity(0.5),
                  height: 1,
                ),
                children: [
                  TextSpan(
                    text: '/元',
                    style: TextStyle(
                      fontSize: 22.sp,
                      color: Colors.white.withOpacity(0.5),
                      height: 1,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
